package com.pxsw.mobile.hcd.dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.mdx.mobile.InitConfig.ErrMsg;
import com.mdx.mobile.dialogs.MDialog;
import com.mdx.mobile.dialogs.MsgDialog;
import com.mdx.mobile.server.Son;
import com.pxsw.mobile.hcd.F;
import com.pxsw.mobile.hcd.R;

public class ErrorDialog extends MDialog implements MsgDialog {
	private Button bt_submit;
	private TextView error_title;

	public ErrorDialog(Context context) {
		super(context, R.style.RDialog);
	}

	public void setMsg(ErrMsg em) {
		if (em.type == 0) {
			error_title.setText(em.msg);
			bt_submit.setText("确认");
		}
		if (em.type == 1) {
			error_title.setText(em.msg);
			bt_submit.setText("退出");
			bt_submit.setOnClickListener(new View.OnClickListener() {
				public void onClick(View v) {
					F.close();
				}
			});
		}

	}

	public void create() {
		this.setContentView(R.layout.error);
		bt_submit = (Button) this.findViewById(R.error.bt_submit);
		error_title = (TextView) this.findViewById(R.error.error_title);
		bt_submit.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				ErrorDialog.this.cancel();
				ErrorDialog.this.dismiss();
			}
		});
	}

	@Override
	public void dataLoad(int[] typs) {

	}

	@Override
	public void disposeMessage(Son son) throws Exception {
	}

	public void toLogin() {
		// TODO Auto-generated method stub
		
	}

}
